from alg import Solution
from gen import generate_test_cases

def run_tests():
    sol = Solution()
    test_cases = [
        ("bcabc", "abc"),
        ("cbacdcbc", "acdb"),
        ("a", "a"),
        ("aa", "a"),
        ("abacb", "abc"),
        *[(s, sol.removeDuplicateLetters(s)) for s in generate_test_cases(5, 10)]
    ]

    for i, (input_str, expected) in enumerate(test_cases, 1):
        output = sol.removeDuplicateLetters(input_str)
        assert output == expected, f"""
Test Case {i} Failed:
  Input:    {input_str}
  Output:   {output}
  Expected: {expected}
"""
        print(f"Test Case {i} Passed: Input={input_str}, Output={output}")

if __name__ == "__main__":
    run_tests()